<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<title>Multi SHIP Calculator</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>asset/css/style.css" media="screen" />
		<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>asset/css/table.css" media="screen" />
		
	</head>
	<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<div id="print">
<table width="809" height="465" border="0">
  <tr bgcolor="#CCCCCC">
    <td width="589"><img src="http://expobytes.com/skin/frontend/default/modern/images/logo.png" alt="" width="235" height="49" border="0"/></td>
    <td width="204"><p>
    <?php if(isset($info)) : foreach($info as $row) :  ?>
    <?php $order = $this->product_model->getOrderInfo($this->uri->segment(3));
   
    foreach($order as $rows){
    	echo "<b>Order Name: </b>".$rows->name."<br />";
		echo "<b>Order Date: </b>".$rows->date."<br />";
    }
    ?>

    <b>Shipped Date:</b> <?php echo $row->date; ?></p></td>
  </tr>
  <tr>
    <td height="137" valign="top">
  <?php 
  echo "<p>";
 echo "<b>Port:</b> ".$this->product_model->get_ports($row->port)."<br />";
 echo "<b>Port of Unloading:</b> ".$this->product_model->get_ports($row->port_unload)."<br />";
  echo "<b>Conveyance:</b> ".$row->conveyance."<br />";
   echo "<b>Vessel Name:</b> ".$row->vessel_name."<br />";
    echo "<b>REF #:</b> ".$row->ref."<br />";
     echo "<b>Booking:</b> ".$row->booking."<br />";
      echo "<b>Sum Insured in US Dollar:</b> $".$row->sum_insured."<br />";
     
?>

    </p></td>
    <td height="137" valign="top">
    <b>Container Serial: </b> <?php echo $row->container_serial; ?><br />
<b>Bar:</b> <?php echo $row->bar1; ?><br />
<b>Seal 1:</b> <?php echo $row->seal1; ?><br />
<b>Seal 2:</b> <?php echo $row->seal2; ?></td>
  <?php  endforeach; ?>
 
  <?php else : ?>	
	<tr>No records were returned.</tr>
	<?php endif; ?>
  </tr>
  <tr>
    <td height="265" colspan="2"><table width="802" height="261" border="0">
    <thead>
      <tr>
        <td width="139"><b>UPC</b></td>
        <td width="141"><b>Model</b></td>
        <td width="222"><b>Description</b></td>
        <td width="48"><b>Amount (MC)</b></td>
        <td width="47"><b>Volume (MT3)</b></td>
        <td width="69"><b>Weight (LB)</b></td>
      </tr>
      <tr>
      </thead>
      <tbody>
        <?php
         
        $finalWeight = 0;
 		$finalAmount = 0;
 		$finalVolume = 0;
 		
        if(isset($records)) : foreach($records as $row) : ?>
 <?php
 //print_r($records);
 
 $weight = number_format($this->product_model->calculateWeight($row->productID)*$row->Amount, 2, '.', ''); 
 $finalWeight += number_format($this->product_model->calculateWeight($row->productID)*$row->Amount, 2, '.', ''); 
 $prod = $this->product_model->get_prod_name($row->productID);

 echo "<tr>";
 //echo "<td>".$row->productID."</td>";
 foreach($prod as $rows){
  echo "<td>".$rows->upc."</td>";
  echo "<td>".$rows->model."</td>";
  echo "<td>".$rows->desc."</td>";
 }
 $finalAmount += $row->Amount;
    echo "<td>".$row->Amount."</td>";
    $finalVolume += $row->Volume;
    echo "<td>".$row->Volume."</td>";
    echo "<td>".$weight."</td>";
 echo "</tr>"; 
 ?>
 <?php endforeach; ?>
 <?php else : ?>	
	<tr>No records were returned.</tr>
	<?php endif; ?>
      </tr>
      <tr>
        <td height="23" colspan="7"><b>Total MC:</b>  <?php echo $finalAmount; ?><br />   <b>Total Volume:</b> <?php echo $finalVolume; ?><br />  <b>Total Weight:</b> <?php echo $finalWeight; ?><br /></td>
        </tr></tbody>
    </table></td>
  </tr>
</table>
</div>
<script type="text/javascript">
//print window popup
setTimeout("window.print()",2000);
		</script>
	</body>
	</html>